<include file="public@header"/>
<style type="text/css">
	.conn{
		width:100%;
		height:auto;
		overflow:hidden;
		background:#f3f3f3;
		margin-top:15px;
	}
	.conn ul{
		width:100%;
		height:auto;
		overflow:hidden;
		padding-left: 0px!important;
	}
	.conn ul li{
		width:100%;
		height:auto;
		overflow:hidden;
		margin-top:15px;
	}
	.conn_t{
		margin-left:20px;
		margin-right:20px;
		height:30px;
		overflow:hidden;
	}
	.conn_t p{
		font-size:17px;
		float:left;
		color:#666666;
		line-height: 30px;
	}
	.conn_t a{
		display:block;
		float:right!important;
		font-size:16px;
		float:left;
		line-height:30px;
		color:#4abde7;
		text-decoration: underline;
	}
	.conn_b{
		margin-left:20px;
		margin-right: 20px;
		height:auto;
		overflow:hidden;
		background:#fff;
	}
	.conn_b div{
		margin-left:20px;
		margin-right: 20px;
		height:auto;
		border-bottom:1px solid #e6e6e6;
		padding-top: 10px;
		padding-bottom: 10px;
	}
	.conn_b div p{
		margin: 0;
		font-size:15px;
	}
	.conn_b div p img{
	    float:right;
	    width: 20px;
	}
	.conn_b div span{
		display:block;
		margin: 0;
		font-size:15px;
		color:#ff9900;
		margin-top:10px;
	}
	.conn_b div p img {
    float: right;
    width: 15px;
}
</style>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="{:url('template/index')}">模板列表</a></li>
        <li><a href="{:url('template/add')}">新建模板</a></li>
    </ul>
   <!--  <form method="post" class="js-ajax-form margin-top-20" action="{:url('template/listOrder')}">
        <table class="table table-hover table-bordered table-list">            
            <tbody>
			<php> for($i=1;$i<=$progressid;$i++){</php>
			步骤{$i}:<a href="{:url('template/addclass_progress',array('mid'=>$mid,'progressid'=>$i))}">子项</a>
			<foreach name="list" item="vo">
				<if condition="$vo['progressid'] eq $i">
					{$vo.question}
					{$vo.reply}
				</if>
			</foreach>
			<br>
			<php>}</php>
            </tbody>
           
        </table>
        
    </form> -->
    <div class="conn">
    	<form method="post" class="js-ajax-form" action="{:url('template/listOrder')}">
			<ul>
				<php> for($i=1;$i<=$progressid;$i++){</php>
					
					<li>
						<div class="conn_t">
							<p>步骤{$i}：<span style="color: #ff9900">{$name[$i]}</span></p>
							
							<a onclick="doEdit({$mid},{$i})" href="javascript:">+子项</a>
							<a onclick="doEditName({$mid},{$i})" href="javascript:" style="margin-right:15px">步骤名称</a>
						</div>
						<div class="conn_b">
							<foreach name="list" item="vo">
								<if condition="$vo['progressid'] eq $i">
									<div>
									<p>{$vo.question}<img onclick="del({$vo.id});" src="/themes/admin_simpleboot3/public/assets/images/close.png"></p>
									<span>{$vo.reply}</span>
									</div>
								</if>
							</foreach>
						</div>
					</li>
				<php>}</php>
			</ul>
		</form>
	</div>
</div>
<script>
	//打开
	function doEditName(mid,i){
        openIframeLayer("/teacher/template_attr/add/template_id/"+mid+"/progress/"+i+'/progressid/'+{$progressid}, '步骤名称', {
            area: ['450px', '450px'],
            yes: function (index, layero) {
                var iframeWin          = window[layero.find('iframe')[0]['name']];
                var selectedCategories = iframeWin.confirm();
            }
        });
	}
	//编辑
    function doEdit(mid,i) {
        //打开新增窗口
        openIframeLayer("/teacher/template/addclass_progress/mid/"+mid+"/progressid/"+i, '添加子项', {
            area: ['450px', '450px'],
            yes: function (index, layero) {
                var iframeWin          = window[layero.find('iframe')[0]['name']];
                var selectedCategories = iframeWin.confirm();
            }
        });
    }
	//删除
	function del(id){
	    var r=confirm("确定要删除吗")
	    if (r==true)
		{
			$.ajax({
			 type: "GET",
             url: "{:url('teacher/template/delclass_progress')}",
             data: {id:id},
             dataType: "json",
             success: function(data){
				window.location.href=window.location.href;
			  }			
			});
		}
		else
		{
			return false;
		}
		
	}
</script>
<script src="__STATIC__/js/admin.js"></script>
</body>
</html>